1 using UnityEngine;
2 using
System.Collections;
3
4 public
class ShowStatusWhenConnecting : MonoBehaviour
5 {
6     
public GUISkin Skin;
7
8     
void OnGUI()
9     {
10         
if( Skin != null )
11         {
12             GUI.skin = Skin;
13         }
14
15         
float width = 400;
16         
float height = 100;
17
18         Rect centeredRect =
new Rect( ( Screen.width - width ) / 2, ( Screen.height - height ) / 2, width, height );
19
20         GUILayout.BeginArea( centeredRect, GUI.skin.box );
21         {
22             GUILayout.Label(
"Connecting" + GetConnectingDots(), GUI.skin.customStyles[ 0 ] );
23             GUILayout.Label(
"Status: " + PhotonNetwork.connectionStateDetailed );
24         }
25         GUILayout.EndArea();
26
27         
if( PhotonNetwork.connectionStateDetailed == PeerState.Joined )
28         {
29             enabled =
false;
30         }
31     }
32
33     
string GetConnectingDots()
34     {
35         
string str = "";
36         
int numberOfDots = Mathf.FloorToInt( Time.timeSinceLevelLoad * 3f % 4 );
37
38         
for( int i = 0; i < numberOfDots; ++i )
39         {
40             str +=
" .";
41         }
42
43         
return str;
44     }
45 }



Trò chơi Tic-Tac-Toe, game đánh caro full source code 53.527 lượt xem

Gõ tìm kiếm nhanh...